home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / AMIGA / AMICUS / AMICUS09.ADF / Assembler / decigel.asm < prev    next >
Assembly Source File  |  1986-05-22  |  3KB  |  67 lines

  1. ;***************************************************************
  2. ;                                                              *
  3. ;       DeciGEL (Relief from MC68010 pains on the Amiga)       *
  4. ;                                                              *
  5. ; Copyright 1986 by Scott Turner                               *
  6. ; Program may be copied and used for non-commercial uses only. *
  7. ; Requests for commercial use should be directed to:           *
  8. ;                                                              *
  9. ; Scott Turner                                                 *
  10. ; 12311 Maplewood Avenue                                       *
  11. ; Edmonds, Wa 98020-1115                                       *
  12. ;                                                              *
  13. ; Execute file to install patch. May be executed over and over *
  14. ; again. You lose about 40 bytes of memory each time you       *
  15. ; execute it though. Reboot your AMiga (Ctrl-Amiga-AMiga) to   *
  16. ; remove the patch.                                            *
  17. ;                                                              *
  18. ; EXECUTE DeciGEL.make                                         *
  19. ; Assembles and links a new DeciGEL                            *
  20. ; Program should work with MC68000/MC68008/MC68012/MC68020     *
  21. ; as well (ie. it won't die on MC68000/MC68008).               *
  22. ;***************************************************************
  23.  
  24. ; Some handy constants
  25. SysBase  EQU      4
  26. AlcMem   EQU      -6*33
  27. PrivVect EQU      $20               ; Address of Privlege error vector
  28.  
  29. Main     movea.l  SysBase,A6
  30.          move.l   CodeSize,D0
  31.          moveq    #0,D1             ; PUBLIC
  32.          jsr      AlcMem(A6)        ; Get the memory
  33.          tst.l    D0                ; Did we get it?
  34.          bne.s    GotIt
  35.          moveq    #100,D0           ; Return Error # 100
  36.          rts                        ; Back to AmigaDOS with error
  37.  
  38. GotIt    move.l   D0,A0             ; Move to work reg
  39.          move.l   D0,A2             ; Save copy for patching vector
  40.          lea      MoveMe,A1         ; Get address of our code
  41.          move.l   CodeSize,D0       ; Number of bytes to move
  42.          subq.l   #5,D0             ; Correct for DBF and one long word
  43. Loop     move.b   (A1)+,(A0)+       ; Move byte
  44.          dbf      D0,Loop
  45.          move.l   PrivVect,(A0)+    ; Patch opcode at end
  46.          move.l   A2,PrivVect       ; Patch us into the vector
  47.          moveq    #0,D0             ; Good return code
  48.          rts                        ; Back to AmigaDOS, no error
  49.  
  50. MoveMe   movem.l  D0/A0,-(SP)       ; Save registers
  51.          move.l   8+2(SP),A0        ; Pointer to opcode
  52.          move.w   (A0),D0           ; Pickup opcode
  53.          andi.w   #~%111111,D0      ; Mask out EA field
  54.          cmpi.w   #$40C0,D0         ; Is it a MOVE SR,ea?
  55.          bne.s    NotOne
  56.          bset     #1,(A0)           ; Convert it to MOVE CCR,ea
  57.          movem.l  (SP)+,D0/A0       ; Restore regs
  58.          rte                        ; Rerun new opcode
  59.  
  60. NotOne   movem.l  (SP)+,D0/A0       ; Restore regs
  61.          jmp      $FC0000           ; To previous handler, patched on
  62.                                     ; installation of this routine
  63. CodeEnd
  64. CodeSize DC.L     CodeEnd-MoveMe    ; Size of routine
  65.          end
  66.